package com.xiaoshou.pojo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "question_files_rel", catalog = "market")
public class QuestionFilesRel implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

	private QuestionFilesRelId id;
	private Files files;
	private Question question;

	// Constructors

	/** default constructor */
	public QuestionFilesRel() {
	}

	/** full constructor */
	public QuestionFilesRel(QuestionFilesRelId id, Files files,
			Question question) {
		this.id = id;
		this.files = files;
		this.question = question;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "questionid", column = @Column(name = "questionid", nullable = false, length = 40)),
			@AttributeOverride(name = "filesid", column = @Column(name = "filesid", nullable = false, length = 40)) })
	public QuestionFilesRelId getId() {
		return this.id;
	}

	public void setId(QuestionFilesRelId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "filesid", nullable = false, insertable = false, updatable = false)
	public Files getFiles() {
		return this.files;
	}

	public void setFiles(Files files) {
		this.files = files;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "questionid", nullable = false, insertable = false, updatable = false)
	public Question getQuestion() {
		return this.question;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}

}